home *** CD-ROM | disk | FTP | other *** search
/ The Macintosh Demo Applications CD / Apple-MacintoshDemoApplicationsCD-1.0-1992.bin / More Information / Personal Press 2.0 / PPPouch / Additions / Text Commands / Pull Quote… / Pull Quote… next >
Text File  |  1992-06-08  |  4KB  |  169 lines

  1. on startup
  2.  
  3. global pullQuoteTop, pullQuoteWidth, pullQuoteBottom, theQuote ,columnWidth
  4. global bailout
  5.  
  6. checkTextToolIsOn
  7.  
  8. if bailout <> "true" then
  9.  
  10. put 0 into pullQuoteTop
  11. put 0 into pullQuoteWidth
  12. put 0 into pullQuoteBottom
  13. put " " into theQuote
  14. put currentstoryNumber() into storyNum
  15.  
  16. --pullQuoteDialog
  17.  
  18. set lockscreen to true
  19.  
  20.  
  21. put char (item 1 of textcursor) to (item 2 of textcursor) ¬
  22. of story storyNum into theQuote
  23.  
  24. put char number(chars in theQuote)-1 of theQuote into theLastChar
  25.  
  26. if theLastChar = cr then
  27. put " " into char number(chars in theQuote)-1 of story theQuote
  28. end if
  29.  
  30.  
  31. calcBounds
  32.  
  33. createPullQuoteStory
  34.  
  35. createPullQuoteFrame
  36.  
  37. end if -- end of bailout
  38.  
  39. end startup
  40.  
  41. on checkTextToolIsOn
  42. global bailout
  43.  
  44.  
  45. put "true" into bailout
  46.  
  47. if toolmode <> "textTool" then
  48. answer "The TextTool must be on and text selected."
  49. else if item 2 of textcursor = 0 then
  50. answer "The text to be quoted must be selected."
  51. else if number of columns = 0 then
  52. answer "Number of columns in Publication Setup is set to 0. Set it to " & ¬
  53. "a number greater than zero."
  54. else
  55. put "false" into bailout
  56. end if
  57.  
  58. end checkTextToolIsOn
  59.  
  60. on createPullQuoteFrame
  61.  
  62. global pullQuoteTop, pullQuoteWidth, pullQuoteBottom, theQuote ,columnWidth
  63.  
  64.  
  65. choose maintool
  66. select last object
  67. align objects to margins center none
  68. select last object
  69. set  fillPattern to 17
  70. set framelinetype to 12
  71. set linepattern to 1
  72. minimizeTextObjectSize  
  73. end createPullQuoteFrame
  74.  
  75. on createPullQuoteStory
  76.  
  77. global pullQuoteTop, pullQuoteWidth, pullQuoteBottom, theQuote ,columnWidth
  78.  
  79. choose maintool
  80. open story "PullQuote"
  81. draw rectangle from leftmargin,pullQuoteTop ¬
  82. to leftmargin + columnWidth,pullQuoteBottom
  83. close story
  84. select objects number(objects)
  85. choose texttool
  86. put "“ ”" into story "PullQuote"
  87. put theQuote into char 2 of story "PullQuote"
  88. select all text
  89. set textSize to 18
  90. set textface to italic
  91. set rulerJustification to center
  92. select text char 1 to 1 of story "PullQuote"
  93. set textSize to 24
  94. set textFace to bold
  95. set findString to "”"
  96. put find() into numFound
  97. set textSize to 24
  98. set textFace to bold
  99.  
  100. end createPullQuoteStory
  101.  
  102. on calcBounds
  103.  
  104. global pullQuoteTop, pullQuoteWidth, pullQuoteBottom, theQuote ,columnWidth
  105.  
  106. put number(columns) into numColumns
  107. put pageWidth - rightMargin - leftmargin into availableWidth 
  108. put  (availableWidth - (columnSpacing *(number(columns)-1))) / ¬
  109. number(columns) into columnWidth
  110.  
  111. put pageHeight - topMargin - bottomMargin into availableHeight
  112. put availableheight /2 into pullQuoteCenter
  113. put 3 into pullQuoteHeight
  114. put pullQuoteCenter - (pullQuoteHeight /2) into pullQuoteTop
  115. put pullQuoteTop + pullQuoteHeight into pullQuoteBottom
  116.  
  117. end calcBounds
  118.  
  119. on pullQuoteDialog
  120.  
  121. put dialog(preload,10500) into thedialog
  122. put "uvda\0" into item8
  123. -- put "uvda\0" into item9
  124. put "uvdp\1" into item6
  125. put "cve-\1,1,100" into item7
  126.  
  127. put 5 into numItems
  128. put 1 into baseID
  129. put 100 / (numItems -1) into theIncrement 
  130. repeat forever
  131. get dialog(display, thedialog)
  132. switch it
  133. case 1
  134. case 2
  135. exit repeat
  136. exit switch
  137. case 7
  138. put round(item 2 of item7 / theIncrement) + baseID into thePicID 
  139. put "---p\"& thepicid into item6
  140. put (thepicid - baseID) * theIncrement into item 2 of item7
  141. put round(item 2 of item7 / theIncrement) * theIncrement into item 2 of item7
  142. exit switch
  143. end switch
  144.  
  145.  
  146. end repeat
  147. put it into results
  148. get dialog(dispose, thedialog)
  149.  
  150. end pullQuoteDialog
  151.  
  152.  
  153. on help
  154.  
  155. put  dialog (preload, 128) into thedialog
  156. put "---a\0" into item2
  157. put "---a\1" into item3
  158. put "---a\2" into item4
  159.  
  160.  
  161. repeat forever
  162. get dialog(display, thedialog)
  163. if (it = 1) then exit repeat
  164. end repeat
  165. get dialog(dispose, thedialog)
  166.  
  167. end help
  168.  
  169.     ØÚ<BÏ